package com.pro.mapper;

import com.pro.pojo.JsDept;
import com.pro.pojo.JsUser;
import com.pro.pojo.JsUserDept;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @Author 祖铭泽
 * @Date 2022/1/20/0020
 * @description 部门 用户表 持久层
 */
@Repository
public interface JsUserDeptMapper {
    /**
     * @Author 祖铭泽
     * @Date 2022/1/20/0020
     * @description 根据用户id查询用户所在部门
     */
    @Select("select dept_name,jud.dept_id id from js_user_dept jud join js_dept jd on jd.id = jud.dept_id where jud.user_id = #{userId} ")
    List<JsDept> getDeptsByUserId(Integer userId);

}
